public class parent {
    // public private protected
    //protected的属性可以被子类直接继承使用，达到代码重用的目的
    protected  String name;
    protected  String sex;
    protected  int age;
    protected  long money;
    //alt+insert组合键

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public long getMoney() {
        return money;
    }

    public void setMoney(long money) {
        this.money = money;
    }
    //如何创建对象
    public static void main(String[] args) {
        parent p=new parent();
        //属性赋值
        p.setAge(25);
        p.setMoney(100000000);
        p.setName("张三");
        p.setSex("男");
        //读取属性
        System.out.println("p.getAge() = " + p.getAge());
        System.out.println("p.getMoney() = " + p.getMoney());
        System.out.println("p.getName() = " + p.getName());
        System.out.println("p.getSex() = " + p.getSex());
      //这是另一个属性，此时空间里有两个属性互不相关，各自申请两个空间互不干扰
        parent p1=new parent();
        p1.setSex("女");
        p1.setAge(26);
        p1.setMoney(1164);
        p1.setName("王武");
        System.out.println("p1 = " + p1);
        System.out.println("p1.getName() = " + p1.getName());
        System.out.println("p1.getMoney() = " + p1.getMoney());

        System.out.println("___________________________");
        child c=new child();
        c.setAge(18);
        c.setMoney(151646L);
        c.setName("六六");
        c.setSex("女");
        System.out.println("c.getMoney() = " + c.getMoney());
        System.out.println("c.getName() = " + c.getName());
        System.out.println("c.getAge() = " + c.getAge());
        System.out.println("c.getSex() = " + c.getSex());
        System.out.println("_____________________");
         child c2=new child();
         c2.setSex("男");
         c2.setName("l");
         c2.setMoney(164753);
         c2.setAge(10);
        System.out.println("c2.getSex() = " + c2.getSex());
        System.out.println("c2.getAge() = " + c2.getAge());
        System.out.println("c2.getName() = " + c2.getName());
        System.out.println("c2.getMoney() = " + c2.getMoney());

    }


}
